#ifndef ICREADER
#define ICREADER

#include "stdbool.h"
//IC-UART part
#define ICREADER_UART_NUM UART_NUM_2
#define UART2_TX_NUM 14
#define UART2_RX_NUM 21
#define PATTERN_CHR_NUM    (3)         /*!< Set the number of consecutive and identical characters received by receiver which defines a UART pattern*/
#define FIRMWARE_UPGRADE_URL "http://42.192.182.10:13140/WiFikey.bin"
#define HASH_LEN 32

//读取卡类型的命令
static unsigned char cardType[7];
//读取数据的命令
static unsigned char cmd[8];
//车辆控制的命令
static unsigned char carCmd[23];
static unsigned char ota_cmd_char[5];
static unsigned char ota_cmd_plain[10];
static unsigned char ota_update[3] = {0x4f, 0x54, 0x41};
static unsigned char reboot_cmd[6] = {0x52, 0x45, 0x42, 0x4f, 0x4f, 0x54};
static unsigned char reboot_now[6] = {0x72, 0x65, 0x62, 0x6f, 0x6f, 0x74};
static unsigned char power_up[26] = {0x3d, 0x3d, 0x3d, 0x3e, 0x3e, 0x3e, 0x45, 0x53, 0x50, 0x33, 0x32, 0x20, 0x50, 0x4f, 0x57, 0x45, 0x52, 0x20, 0x55, 0x50, 0x3c, 0x3c, 0x3c, 0x3d, 0x3d, 0x3d};
static unsigned char start_engine[12] = {0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65};
static unsigned char engine_started[14] = {
    0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64
};
static unsigned char engine_on[6] = {0x45, 0x4e, 0x47, 0x20, 0x4f, 0x4e};
static unsigned char engine_off[7] = {0x45, 0x4e, 0x47, 0x20, 0x4f, 0x46, 0x46};

void icreader_init();
unsigned char txchecksum(unsigned char *ptr,unsigned char len);
bool checkData(unsigned char* src, unsigned char* dst, int start_i, int check_num);

#endif